package com.ruoyi.system.mapper;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.SysUserJudges;
import com.ruoyi.system.domain.SysUsers;
import com.ruoyi.system.domain.SyseEventsPosted;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SysUsersMapper {

        /**
         * 根据教师id查询教师评审员信息
         */
        public SysUsers queryUserByTid(SysUsers sysUsers);

        public SysUsers queryByTid(String tid);

    /**
     * 查询是否被邀请过
     * @param sysUsers
     * @return
     */
    public SysUserJudges queryIsJudges(SysUsers sysUsers);


        /**
         * 查询全部评委
         * @return
         */
        public List<SysUserJudges> readUserAll(Map<String, Object> param);

        /**
         *  修改评委状态
         * @param userId
         * @return
         */
        public long updateStatus(Integer userId);

        /**
         *  查询所有赛事
         * @return
         */
        public List<SyseEventsPosted> readEventAll(SyseEventsPosted eventsPosted);

        /**
         * 查询赛事总条数
         */
        @Select("select count(*) from events_posted where epstate != 0 ORDER BY epstate, epprestart ")
        long EventAllCount();
    /**
     * 查询不是评委
         * @param
         * @return
         */
        public List<SysUsers>  readNoUser(SysUsers sysUsers);

        /**
         * 读取一条评委信息
         * @return
         */
        public SysUsers readUserById(Integer userId);

        /**
         * 新增一条评委信息
         * @param sysUsers
         * @return
         */
        public long insertUser(SysUsers sysUsers);

        /**
         *读取要添加的评委信息
         * @return
         */
        public SysUsers readInsertUser(Integer userId);

        /**
         * 新增中间表数据
         * @param userId
         * @param epid
         * @return
         */
        public long insertUserEvent(long userId,String epid);

        /**
         * 获取最后添加Id
         * @return
         */
        public long readLastUserId();

        /**
         * 删除赛事表及联合表
         * @return
         */
        public long deleteUser(long userId);


        long addJudges(SysUsers users);

    /**
     * 查询赛事
     */
    List<SyseEventsPosted> readEvents(String schoolName);

    /**
     * 查询全部
     * */
    List<SysUsers> selectByIsJudges();

    //根据用户id 和 姓名 和手机号码
    List<SysUsers> selectUserCondition(Map<String, Object> paramLike);


    List<SysUsers> selectUserCondition02(Map<String, Object> paramLike);

}
